home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 June / PersonalComputerWorld-June2009-CoverdiscCD.iso / Software / Freeware / Firebug 1.3.3 / firebug-1.3.3-fx.xpi / content / firebug / bindings.xml next >
Encoding:
Extensible Markup Language  |  2008-12-19  |  29.2 KB  |  828 lines

  1. <?xml version="1.0"?>
  2.  
  3. <!DOCTYPE window [
  4. <!ENTITY % firebugDTD SYSTEM "chrome://firebug/locale/firebug.dtd">
  5. %firebugDTD;
  6. ]>
  7.  
  8. <bindings xmlns="http://www.mozilla.org/xbl"
  9.     xmlns:xbl="http://www.mozilla.org/xbl"
  10.     xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
  11.  
  12. <binding id="initializer">
  13.     <implementation>
  14.         <destructor><![CDATA[
  15.            FirebugChrome.shutdown();
  16.         ]]></destructor>
  17.     </implementation>
  18. </binding>
  19.  
  20. <binding id="panelBar">
  21.     <content>
  22.         <xul:hbox anonid="tabBox" class="panelTabBox" collapsed="true">
  23.             <children includes="panelTab"/>
  24.             <xul:spacer flex="1"/>
  25.             <children/>
  26.             <xul:toolbarbutton type="menu" class="toolbar-text-menubutton panelOptionsButton" label="&firebug.Options;" anonid="panelOptions">
  27.                 <xul:menupopup anonid="optionsPopup"/>
  28.             </xul:toolbarbutton>
  29.         </xul:hbox>
  30.         <xul:deck anonid="deck" flex="1">
  31.             <xul:browser anonid="browser"
  32.                      xbl:inherits="tooltip=paneltooltip,contextmenu=panelcontextmenu"
  33.                      disablehistory="true"
  34.                      src="chrome://firebug/content/panel.html"/>
  35.         </xul:deck>
  36.     </content>
  37.  
  38.     <implementation>
  39.         <constructor><![CDATA[
  40.             this.tabBox = document.getAnonymousElementByAttribute(this, "anonid", "tabBox");
  41.             this.optionsPopup = document.getAnonymousElementByAttribute(this, "anonid", "optionsPopup");
  42.             this.deck = document.getAnonymousElementByAttribute(this, "anonid", "deck");
  43.             this.browser = document.getAnonymousElementByAttribute(this, "anonid", "browser");
  44.             this.tabMap = {};
  45.  
  46.             // We initialize Firebug from here instead of from the onload event because
  47.             // we need to make sure it is initialized before the browser starts loading
  48.             // the home page
  49.             try {
  50.                 FirebugChrome.panelBarReady(this);
  51.             }
  52.             catch (e)
  53.             {
  54.                 dump("bindings panelBar ctor FAILs: "+ e+"\n");
  55.                 dump("window.top "+window.top.location+" window.opener: "+window.opener+"\n");
  56.             }
  57.         ]]></constructor>
  58.  
  59.         <method name="createTab">
  60.             <parameter name="panelType"/>
  61.             <body><![CDATA[
  62.             var tab = document.createElement("panelTab");
  63.             tab.panelType = panelType;
  64.  
  65.             var title = Firebug.getPanelTitle(panelType);
  66.             tab.setAttribute("label", title);
  67.  
  68.             return this.tabMap[panelType.prototype.name] = tab;
  69.             ]]></body>
  70.         </method>
  71.  
  72.         <method name="addTab">
  73.             <parameter name="panelType"/>
  74.             <body><![CDATA[
  75.             var tab = this.createTab(panelType);
  76.             this.appendChild(tab);
  77.             ]]></body>
  78.         </method>
  79.  
  80.         <method name="updatePanels">
  81.             <parameter name="panelTypes"/>
  82.             <body><![CDATA[
  83.                 this.tabMap = {};
  84.  
  85.                 // Replace tabs at the same position if type has changed
  86.                 var i = 0;
  87.                 var tab = this.firstChild;
  88.                 for (; i < panelTypes.length && tab; tab = tab.nextSibling)
  89.                 {
  90.                     var panelType = panelTypes[i++];
  91.                     if (tab.panelType.prototype.name != panelType.prototype.name)
  92.                     {
  93.                         var newTab = this.createTab(panelType);
  94.                         this.replaceChild(newTab, tab);
  95.                         tab = newTab;
  96.                     }
  97.                     else
  98.                         this.tabMap[panelType.prototype.name] = tab;
  99.                 }
  100.  
  101.                 // Remove old tabs after the last panel
  102.                 while (tab)
  103.                 {
  104.                     var nextTab = tab.nextSibling;
  105.                     this.removeChild(tab);
  106.                     tab = nextTab;
  107.                 }
  108.  
  109.                 // Insert new tabs after the last old tab
  110.                 for (; i < panelTypes.length; ++i)
  111.                 {
  112.                     var panelType = panelTypes[i];
  113.                     var newTab = this.createTab(panelType);
  114.                     this.appendChild(newTab);
  115.                 }
  116.             ]]></body>
  117.         </method>
  118.  
  119.         <method name="selectTab">
  120.             <parameter name="tab"/>
  121.             <body><![CDATA[
  122.                 var panelName = tab ? tab.panelType.prototype.name : null;
  123.                 if (panelName && !tab.panelType.prototype.parentPanel)
  124.                     Firebug.setPref(Firebug.prefDomain, "defaultPanelName", panelName);
  125.  
  126.                 this.selectPanel(panelName);
  127.             ]]></body>
  128.         </method>
  129.  
  130.         <method name="selectPanel">
  131.             <parameter name="panelName"/>
  132.             <parameter name="forceUpdate"/>
  133.             <parameter name="noRefresh"/>
  134.             <body><![CDATA[
  135.                 var tab = panelName ? this.tabMap[panelName] : null;
  136.                 var panelType = tab ? tab.panelType : null;
  137.  
  138.                 var panel = FirebugContext ? FirebugContext.getPanel(panelName) : null;
  139.  
  140.                 if (panel && panel == this.selectedPanel && !forceUpdate)
  141.                     return panel;
  142.  
  143.                 if (!panel)
  144.                     this.tabBox.setAttribute("collapsed", "true");
  145.                 else
  146.                     this.tabBox.removeAttribute("collapsed");
  147.  
  148.                 if (this.selectedTab)
  149.                     this.selectedTab.removeAttribute("selected");
  150.  
  151.                 this.hideSelectedPanel();
  152.  
  153.                 this.selectedTab = tab;
  154.                 this.selectedPanel = panel;
  155.  
  156.                 if (tab)
  157.                     tab.setAttribute("selected", "true");
  158.  
  159.                 if (panel)
  160.                 {
  161.                     panel.panelBrowser = panel.browser ? panel.browser : this.browser;
  162.                     panel.panelBrowser.currentPanel = panel;
  163.                 }
  164.  
  165.                 if (!panel || panel.panelBrowser != this.browser)
  166.                     this.browser.currentPanel = null;
  167.  
  168.                 var ev = document.createEvent("Events");
  169.                 ev.initEvent("selectingPanel", true, false);
  170.                 this.dispatchEvent(ev);
  171.  
  172.                 if (panel)
  173.                 {
  174.                     var sel = this.browser.contentWindow.getSelection();
  175.                     if (sel)
  176.                         sel.removeAllRanges();
  177.  
  178.                     this.showSelectedPanel();  // sets active attribute true
  179.  
  180.                     if (!noRefresh && panel.needsRefresh)
  181.                     {
  182.                         delete panel.needsRefresh;
  183.                         panel.refresh();
  184.                     }
  185.  
  186.                     if (panel.browser)
  187.                     {
  188.                         if (panel.browser.parentNode != this.deck)
  189.                             this.deck.appendChild(panel.browser);
  190.  
  191.                         this.deck.selectedPanel = panel.browser;
  192.                     }
  193.                     else
  194.                         this.deck.selectedPanel = this.browser;
  195.                 }
  196.  
  197.                 var ev = document.createEvent("Events");
  198.                 ev.initEvent("selectPanel", true, false);
  199.                 this.dispatchEvent(ev);
  200.  
  201.                 return panel;
  202.             ]]></body>
  203.         </method>
  204.  
  205.         <method name="showSelectedPanel">
  206.             <body><![CDATA[
  207.                 var panel = this.selectedPanel;
  208.                 if (panel)
  209.                 {
  210.                     panel.visible = true;
  211.                     panel.panelNode.setAttribute("active", true);
  212.  
  213.                     var state = Firebug.getPanelState(panel);
  214.                     panel.show(state);
  215.  
  216.                     var menu = panel.getOptionsMenuItems(FirebugContext);
  217.                     var panelOptions = document.getAnonymousElementByAttribute(this, "anonid", "panelOptions");
  218.                     panelOptions.disabled = (!menu || !menu.length);
  219.                 }
  220.             ]]></body>
  221.         </method>
  222.  
  223.         <method name="hideSelectedPanel">
  224.             <body><![CDATA[
  225.                 var oldPanel = this.selectedPanel;
  226.                 if (oldPanel)
  227.                 {
  228.                     oldPanel.visible = false;  // xxxjjb Why three ways to un-show the panel?
  229.                     var state = Firebug.getPanelState(oldPanel);
  230.                     oldPanel.hide(state);
  231.                     oldPanel.panelNode.removeAttribute("active");
  232.                 }
  233.             ]]></body>
  234.         </method>
  235.  
  236.         <method name="getTab">
  237.             <parameter name="panelName"/>
  238.             <body><![CDATA[
  239.                 return this.tabMap[panelName];
  240.             ]]></body>
  241.         </method>
  242.     </implementation>
  243.  
  244.     <handlers>
  245.         <handler event="popupshowing"><![CDATA[
  246.             if (!this.selectedPanel || (event.target != this))
  247.                 return;
  248.  
  249.             var menu = this.selectedPanel.getOptionsMenuItems(FirebugContext);
  250.  
  251.             if (this.selectedTab.getAttribute("disabled") == "true")
  252.             {
  253.                 for (var i = 0; i < menu.length; i++)
  254.                     menu[i].disabled = true;
  255.             }
  256.  
  257.             if (menu)
  258.             {
  259.                 for (var i = 0; i < menu.length; ++i)
  260.                     FBL.createMenuItem(this.optionsPopup, menu[i]);
  261.             }
  262.         ]]></handler>
  263.  
  264.         <handler event="popuphidden"><![CDATA[
  265.             FBL.eraseNode(this.optionsPopup);
  266.         ]]></handler>
  267.  
  268.         <handler event="mousedown" button="0"><![CDATA[
  269.             var tab = event.target;
  270.             for (; tab && !tab.panelType; tab = tab.parentNode);
  271.  
  272.             if (tab)
  273.             {
  274.                 // Select after a timeout to increase teh snappy
  275.                 setTimeout(FBL.bindFixed(function()
  276.                 {
  277.                     this.selectTab(tab);
  278.                 }, this));
  279.             }
  280.         ]]></handler>
  281.     </handlers>
  282. </binding>
  283.  
  284. <binding id="panelTab" display="xul:button">
  285.     <content>
  286.         <xul:image class="panelTab-left"/>
  287.         <xul:label class="panelTab-text" crop="right" flex="1"
  288.                    xbl:inherits="value=label,accesskey,crop,toolbarmode,buttonstyle,disabled"/>
  289.         <children includes="panelTabMenu"/>
  290.         <xul:image class="panelTab-right"/>
  291.     </content>
  292.     <implementation>
  293.         <method name="initTabMenu">
  294.             <parameter name="module"/>
  295.             <body><![CDATA[
  296.             if (!this.tabMenu)
  297.             {
  298.                 this.tabMenu = document.createElement("panelTabMenu");
  299.                 this.tabMenu.module = module;
  300.                 return this.appendChild(this.tabMenu);
  301.             }
  302.             return this.tabMenu;
  303.             ]]></body>
  304.         </method>
  305.     </implementation>
  306. </binding>
  307.  
  308. <binding id="panelTabMenu" display="xul:button" extends="chrome://global/content/bindings/toolbarbutton.xml#toolbarbutton">
  309.     <content>
  310.         <xul:menupopup anonid="popup"
  311.                        oncommand="return this.parentNode.onCommand(event)">
  312.             <xul:menuitem type="radio" value="enable"/>
  313.             <xul:menuitem type="radio" value="disable"/>
  314.             <xul:menuitem type="radio" value="enable-site"/>
  315.             <xul:menuitem type="radio" value="disable-site"/>
  316.             <xul:menuseparator />
  317.             <xul:menuitem label="&firebug.Permissions;"
  318.                           oncommand="this.parentNode.parentNode.openPermissions(event)"/>
  319.         </xul:menupopup>
  320.         <xul:image anonid="menuTarget" class="menuTarget"/>
  321.     </content>
  322.     <implementation>
  323.         <constructor>
  324.         <![CDATA[
  325.            this.popup = document.getAnonymousElementByAttribute(this, "anonid", "popup");
  326.            this.popup.tooltip
  327.         ]]>
  328.         </constructor>
  329.         <field name="value"/>
  330.         <field name="module"/>
  331.         <method name="onCommand">
  332.             <parameter name="event"/>
  333.             <body><![CDATA[
  334.                 var menu = event.target;
  335.                 this.module.setHostPermission(FirebugContext, menu.value);
  336.                 if (menu.value.indexOf("disable") == 0)
  337.                     Firebug.ModuleManagerPage.refresh();
  338.             ]]></body>
  339.         </method>
  340.         <method name="openPermissions">
  341.             <parameter name="event"/>
  342.             <body><![CDATA[
  343.                 this.module.openPermissions(event, FirebugContext);
  344.             ]]></body>
  345.         </method>
  346.     </implementation>
  347.     <handlers>
  348.         <handler event="mousedown" button="0"><![CDATA[
  349.             this.popup.showPopup(this, -1, -1, "popup", "bottomleft", "topleft");
  350.         ]]></handler>
  351.         <handler event="popupshowing"><![CDATA[
  352.             // XXXjjb getElementsByTagName("xul:menuitem"); fails 2.0.0.16
  353.             var items = this.popup.getElementsByTagNameNS("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul","menuitem");
  354.             var location = FirebugChrome.getBrowserURI(FirebugContext);
  355.             var value = this.module.getHostPermission(FirebugContext);
  356.  
  357.             for (var i=0; i<items.length; i++)
  358.             {
  359.                 var option = items[i].value;
  360.                 if (!option)
  361.                     continue;
  362.  
  363.                 if (option == value)
  364.                     items[i].setAttribute("checked", "true");
  365.  
  366.                 items[i].label = this.module.getMenuLabel(option, location);
  367.             }
  368.             return true;
  369.         ]]></handler>
  370.     </handlers>
  371. </binding>
  372.  
  373. <binding id="panelStatus">
  374.     <implementation>
  375.         <method name="addItem">
  376.             <parameter name="label"/>
  377.             <parameter name="object"/>
  378.             <parameter name="rep"/>
  379.             <parameter name="separator"/>
  380.             <body><![CDATA[
  381.                 if (this.firstChild)
  382.                 {
  383.                     var sep = document.createElement("label");
  384.                     sep.setAttribute("class", "panelStatusSeparator");
  385.                     sep.setAttribute("value", separator);
  386.                     this.appendChild(sep);
  387.                 }
  388.  
  389.                 var item = document.createElement("label");
  390.                 item.setAttribute("class", "panelStatusLabel");
  391.                 item.setAttribute("value", label);
  392.                 item.repObject = object;
  393.                 item.rep = rep;
  394.                 this.appendChild(item);
  395.                 return item;
  396.             ]]></body>
  397.         </method>
  398.  
  399.         <method name="clear">
  400.             <parameter name="tab"/>
  401.             <body><![CDATA[
  402.                 while (this.lastChild)
  403.                     this.removeChild(this.lastChild);
  404.             ]]></body>
  405.         </method>
  406.  
  407.         <method name="getItemByObject">
  408.             <parameter name="object"/>
  409.             <body><![CDATA[
  410.                 for (var item = this.lastChild; item; item = item.previousSibling)
  411.                 {
  412.                     if (item.rep)
  413.                     {
  414.                         var itemObject = item.rep.getRealObject(item.repObject, FirebugContext);
  415.                         if (itemObject == object)
  416.                             return item;
  417.                     }
  418.                 }
  419.             ]]></body>
  420.         </method>
  421.  
  422.         <method name="selectObject">
  423.             <parameter name="object"/>
  424.             <body><![CDATA[
  425.                 var item = this.getItemByObject(object);
  426.                 this.selectItem(item);
  427.             ]]></body>
  428.         </method>
  429.  
  430.         <method name="selectItem">
  431.             <parameter name="item"/>
  432.             <body><![CDATA[
  433.                 if (this.selectedItem)
  434.                     this.selectedItem.removeAttribute("selected");
  435.  
  436.                 this.selectedItem = item;
  437.  
  438.                 if (item)
  439.                     item.setAttribute("selected", "true");
  440.             ]]></body>
  441.         </method>
  442.     </implementation>
  443.  
  444.     <handlers>
  445.         <handler event="mousedown" button="0"><![CDATA[
  446.             var object = Firebug.getRepObject(event.target);
  447.             if (object)
  448.             {
  449.                 var rep = Firebug.getRep(object);
  450.                 object = rep.getRealObject(object, FirebugContext);
  451.                 if (object)
  452.                 {
  453.                     this.selectObject(object);
  454.                     FirebugContext.chrome.select(object, null, null, true);
  455.                 }
  456.             }
  457.         ]]></handler>
  458.  
  459.         <handler event="mouseover"><![CDATA[
  460.             var object = Firebug.getRepObject(event.target);
  461.             if (object)
  462.             {
  463.                 var rep = Firebug.getRep(object);
  464.                 object = rep.getRealObject(object, FirebugContext);
  465.                 if (object)
  466.                     Firebug.Inspector.highlightObject(object, FirebugContext);
  467.             }
  468.         ]]></handler>
  469.  
  470.         <handler event="mouseout"><![CDATA[
  471.             Firebug.Inspector.highlightObject(null);
  472.         ]]></handler>
  473.     </handlers>
  474. </binding>
  475.  
  476. <binding id="panelFileList" display="xul:menu">
  477.     <content popup="_child">
  478.         <xul:label class="toolbarbutton-text"
  479.              xbl:inherits="value=label,tooltip=labeltooltip,contextmenu=labelcontextmenu"/>
  480.         <xul:image class="toolbarbutton-menu-dropmarker"/>
  481.         <xul:menupopup anonid="popup" position="after_start"/>
  482.     </content>
  483.  
  484.     <resources>
  485.         <stylesheet src="chrome://global/skin/toolbarbutton.css"/>
  486.     </resources>
  487.  
  488.     <implementation>
  489.         <constructor><![CDATA[
  490.             this.popup = document.getAnonymousElementByAttribute(this, "anonid", "popup");
  491.             this._closed = true;
  492.         ]]></constructor>
  493.  
  494.         <property name="location">
  495.             <getter><![CDATA[
  496.                 return this.getAttribute("location");
  497.             ]]></getter>
  498.  
  499.             <setter><![CDATA[
  500.                 var locator = this.getLocator();
  501.                 
  502.                 var fileName = null;
  503.                 if (!locator)
  504.                     fileName = "no locator!";
  505.                 else if (val)
  506.                     fileName = locator.getObjectDescription(val).name;
  507.                 else
  508.                     fileName = "(none)";
  509.                     
  510.                 this.repObject = val;
  511.                 this.setAttribute("label", FBL.cropString(fileName, 80));
  512.                 this.setAttribute("location", val);
  513.             ]]></setter>
  514.         </property>
  515.  
  516.         <method name="getLocator">
  517.             <body><![CDATA[
  518.                 if (!this.locator)  // XXXjjb this is complicated because the location list depends upon the current panel
  519.                 {
  520.                     var functionYieldingExpression = this.getAttribute("locationProvider");
  521.                     if (functionYieldingExpression && functionYieldingExpression.length > 0)
  522.                         this.locator = eval(functionYieldingExpression);
  523.                     else
  524.                     {
  525.                         var whichBinding = this.getAttribute("id");
  526.                         var msg = "panelFileList "+whichBinding+" requires attribute \'locationProvider\', an expression yielding a function";
  527.                         FBTrace.sysout(msg);
  528.                         return null;
  529.                     }
  530.                 }
  531.                 return this.locator(this);
  532.             ]]></body>
  533.         </method>
  534.  
  535.         <method name="showPopup">
  536.             <body><![CDATA[
  537.                 this.popup.showPopup(this, -1, -1, "popup", "bottomleft", "topleft");
  538.             ]]></body>
  539.         </method>
  540.  
  541.         <method name="selectObject">
  542.             <parameter name="object"/>
  543.             <body><![CDATA[
  544.                 this.repObject = object;
  545.  
  546.                 var ev = document.createEvent("Events");
  547.                 ev.initEvent("selectObject", true, false);
  548.                 this.dispatchEvent(ev);
  549.                 Firebug.Search.displayOnly("", FirebugContext);
  550.             ]]></body>
  551.         </method>
  552.  
  553.         <method name="enterActiveItem">
  554.             <body><![CDATA[
  555.                 for (var child = this.popup.firstChild; child; child = child.nextSibling)
  556.                 {
  557.                     if (child.getAttribute("_moz-menuactive") == "true")
  558.                     {
  559.                         this.location = child.repObject;
  560.                         this.selectObject(child.repObject);
  561.                         this.popup.hidePopup();
  562.                     }
  563.                 }
  564.             ]]></body>
  565.         </method>
  566.  
  567.         <method name="filterList">
  568.             <parameter name="substring"/>
  569.             <body><![CDATA[
  570.                 var firstMatch = null;
  571.                 var groupMatchCount = 0;
  572.                 for (var child = this.popup.lastChild; child; child = child.previousSibling)
  573.                 {
  574.                     if (child.localName == "menuitem")
  575.                     {
  576.                         var label = child.getAttribute("label").toLowerCase();
  577.                         child._searchMatch = label.indexOf(substring) != -1;
  578.                         if (child._searchMatch)
  579.                         {
  580.                             firstMatch = child;
  581.                             ++groupMatchCount;
  582.                         }
  583.                     }
  584.                     else
  585.                     {
  586.                         child._searchMatch = !!groupMatchCount;
  587.                         groupMatchCount = 0;
  588.                     }
  589.                 }
  590.  
  591.                 if (firstMatch)
  592.                 {
  593.                     for (var child = this.popup.firstChild; child; child = child.nextSibling)
  594.                     {
  595.                         child.hidden = !child._searchMatch;
  596.                         child.removeAttribute("_moz-menuactive");
  597.                     }
  598.  
  599.                     firstMatch.setAttribute("_moz-menuactive", "true");
  600.                 }
  601.             ]]></body>
  602.         </method>
  603.  
  604.         <method name="onKeyPress">
  605.             <parameter name="event"/>
  606.             <body><![CDATA[
  607.                 if (event.keyCode == 13) // Return
  608.                 {
  609.                     this.enterActiveItem();
  610.                     this.searchString = '';
  611.                 }
  612.                 else if (event.keyCode == 8) // Backspace
  613.                 {
  614.                     this.searchString = this.searchString.substr(0, this.searchString.length-1);
  615.                     this.filterList(this.searchString);
  616.                 }
  617.                 else if (event.charCode)
  618.                 {
  619.                     this.searchString += String.fromCharCode(event.charCode).toLowerCase();
  620.                     this.filterList(this.searchString);
  621.                 }
  622.                 else
  623.                     return;
  624.  
  625.                 Firebug.Search.displayOnly(this.searchString, FirebugContext);
  626.                 FBL.cancelEvent(event);
  627.             ]]></body>
  628.         </method>
  629.     </implementation>
  630.  
  631.     <handlers>
  632.         <handler event="popupshowing"><![CDATA[
  633.             if (this.popup.firstChild)
  634.                 return false;
  635.             var locator = this.getLocator();
  636.             var objects = locator.getLocationList();
  637.             if (!objects)
  638.             {
  639.                 this.setAttribute("label", "");
  640.                 this.setAttribute("location", null);
  641.                 return false;
  642.             }
  643.  
  644.             var groupNames = [];
  645.             var groups = {};
  646.  
  647.             for (var i = 0; i < objects.length; ++i)
  648.             {
  649.                 var object = objects[i];
  650.                 var splitName = locator.getObjectDescription(object);
  651.  
  652.                 var entry = {object: object, fileName: splitName.name};
  653.  
  654.                 if (groups.hasOwnProperty(splitName.path))
  655.                     groups[splitName.path].push(entry);
  656.                 else
  657.                 {
  658.                     groups[splitName.path] = [entry];
  659.                     groupNames.push(splitName.path);
  660.                 }
  661.             }
  662.  
  663.             groupNames.sort();
  664.  
  665.             for (var i = 0; i < groupNames.length; ++i)
  666.             {
  667.                 var path = groupNames[i];
  668.                 var urls = groups[path];
  669.                 urls.sort(function(a, b) { return a.fileName < b.fileName ? -1 : 1; });
  670.  
  671.                 var menuHeader = FBL.createMenuHeader(this.popup, {label: path, nol10n: true});
  672.                 FBL.setClass(menuHeader, "fbURLMenuItem");
  673.  
  674.                 for (var j = 0; j < urls.length; ++j)
  675.                 {
  676.                     var menuInfo = {label: urls[j].fileName, nol10n: true};
  677.                     if (urls[j].object == locator.location)
  678.                     {
  679.                         menuInfo.type = "checkbox";
  680.                         menuInfo.checked = true;
  681.                     }
  682.  
  683.                     var menuItem = FBL.createMenuItem(this.popup, menuInfo);
  684.                     menuItem.repObject = urls[j].object;
  685.                     FBL.setClass(menuItem, "fbURLMenuItem");
  686.                 }
  687.             }
  688.  
  689.         ]]></handler>
  690.  
  691.         <handler event="popupshown"><![CDATA[
  692.             // Weird, but this gets fired when the user clicks on a menuitem,
  693.             // which hiding the buttons again and resulting in jitters - let's avoid that.
  694.             if (!this._closed)
  695.                 return;
  696.  
  697.             // XXXjoe There is a bug in the <xul:autoscrollbox> code which,
  698.             // for reasons I don't grasp yet, never hides the scroll buttons
  699.             // after the first them they are shown - so we must do it ourselves
  700.             var scrollbox = document.getAnonymousElementByAttribute(
  701.                 this.popup, "class", "popup-internal-box");
  702.             if (scrollbox["_scrollButtonUp"])
  703.                 scrollbox["_scrollButtonUp"].collapsed = true;
  704.             if (scrollbox["_scrollButtonDown"])
  705.                 scrollbox["_scrollButtonDown"].collapsed = true;
  706.  
  707.             this._closed = false;
  708.  
  709.             this.searchString = "";
  710.             this.onkeypress = FBL.bind(this.onKeyPress, this);
  711.             window.addEventListener("keypress", this.onkeypress, true);
  712.         ]]></handler>
  713.  
  714.         <handler event="popuphidden"><![CDATA[
  715.             window.removeEventListener("keypress", this.onkeypress, true);
  716.             delete this.onkeypress;
  717.             delete this.searchString;
  718.  
  719.             FBL.eraseNode(this.popup);
  720.             this._closed = true;
  721.         ]]></handler>
  722.  
  723.         <handler event="command"><![CDATA[
  724.             var object = event.originalTarget.repObject;
  725.  
  726.             // Select after a timeout to increase teh snappy
  727.             setTimeout(FBL.bindFixed(function()
  728.             {
  729.                 this.selectObject(object);
  730.             }, this));
  731.         ]]></handler>
  732.     </handlers>
  733. </binding>
  734.  
  735. <binding id="searchBox" extends="chrome://global/content/bindings/autocomplete.xml#autocomplete">
  736.     <handlers>
  737.         <handler event="keypress"><![CDATA[
  738.             if (event.keyCode == 13)
  739.             {
  740.                 if (FBL.isControl(event))
  741.                     Firebug.Search.enter(FirebugContext);
  742.                 else
  743.                     Firebug.Search.update(FirebugContext, true);
  744.             }
  745.             else if (event.keyCode == 27)
  746.                 Firebug.Search.cancel(FirebugContext);
  747.             else
  748.                 return;
  749.  
  750.             FBL.cancelEvent(event);
  751.         ]]></handler>
  752.  
  753.         <handler event="input"><![CDATA[
  754.             Firebug.Search.update(FirebugContext);
  755.         ]]></handler>
  756.     </handlers>
  757. </binding>
  758.  
  759. <binding id="commandLine" extends="chrome://global/content/bindings/textbox.xml#textarea">
  760.     <handlers>
  761.         <handler event="input"><![CDATA[
  762.             Firebug.CommandLine.update(FirebugContext);
  763.         ]]></handler>
  764.  
  765.         <handler event="overflow"><![CDATA[
  766.             if (window.Firebug)
  767.                 Firebug.CommandLine.checkOverflow(FirebugContext);
  768.         ]]></handler>
  769.  
  770.         <handler event="keypress" keycode="VK_TAB"><![CDATA[
  771.             Firebug.CommandLine.complete(FirebugContext, FBL.isShift(event));
  772.             event.preventDefault();
  773.         ]]></handler>
  774.  
  775.         <handler event="keypress" keycode="VK_RETURN" modifiers="" preventdefault="true"><![CDATA[
  776.             Firebug.CommandLine.enter(FirebugContext);
  777.         ]]></handler>
  778.  
  779.         <handler event="keypress" keycode="VK_RETURN" modifiers="meta" preventdefault="true"><![CDATA[
  780.             Firebug.CommandLine.enterMenu(FirebugContext);
  781.         ]]></handler>
  782.  
  783.         <handler event="keypress" keycode="VK_RETURN" modifiers="shift" preventdefault="true"><![CDATA[
  784.             Firebug.CommandLine.enterInspect(FirebugContext);
  785.         ]]></handler>
  786.  
  787.         <handler event="keypress" keycode="VK_UP" preventdefault="true"><![CDATA[
  788.             Firebug.CommandLine.cycleCommandHistory(FirebugContext, -1);
  789.         ]]></handler>
  790.  
  791.         <handler event="keypress" keycode="VK_DOWN" preventdefault="true"><![CDATA[
  792.             Firebug.CommandLine.cycleCommandHistory(FirebugContext, 1);
  793.         ]]></handler>
  794.  
  795.         <handler event="keypress" keycode="VK_ESCAPE" preventdefault="true"><![CDATA[
  796.             Firebug.CommandLine.cancel(FirebugContext);
  797.         ]]></handler>
  798.     </handlers>
  799. </binding>
  800.  
  801. <binding id="largeCommandLine" extends="chrome://global/content/bindings/textbox.xml#textarea">
  802.     <handlers>
  803.         <handler event="input"><![CDATA[
  804.             Firebug.CommandLine.update(FirebugContext);
  805.         ]]></handler>
  806.  
  807.         <handler event="keypress" keycode="VK_TAB"><![CDATA[
  808.             var input = document.getAnonymousElementByAttribute(this, "anonid", "input");
  809.             FBL.insertTextIntoElement(input, Firebug.Editor.tabCharacter);
  810.             event.preventDefault();
  811.         ]]></handler>
  812.  
  813.         <handler event="keypress" keycode="VK_RETURN" modifiers="meta" preventdefault="true"><![CDATA[
  814.             Firebug.CommandLine.enter(FirebugContext);
  815.         ]]></handler>
  816.  
  817.         <handler event="keypress" keycode="VK_RETURN" modifiers="control" preventdefault="true"><![CDATA[
  818.             Firebug.CommandLine.enter(FirebugContext);
  819.         ]]></handler>
  820.  
  821.         <handler event="keypress" keycode="VK_ESCAPE" preventdefault="true"><![CDATA[
  822.             Firebug.CommandLine.cancel(FirebugContext);
  823.         ]]></handler>
  824.     </handlers>
  825. </binding>
  826.  
  827. </bindings>
  828.